<?php
namespace Game\Factory;

use Game\Entity\Character;
use Game\Entity\Person;
use Game\Entity\Bot;

/**
 * Description of CharacterFactory
 *
 * @author pahhan
 */
class CharacterFactory
{
    /**
     * Create Character
     * @return Game\Entity\Character
     * @param string $type
     * @param array $array properties for character
     */
    public function create($type, array $array = array())
    {
        if( $type == 'person' )
            $char = Person();
        elseif( $type == 'bot' )
            $char = new Bot();
        else
            throw new \InvalidArgumentException('Unknown item type');

        $char->fromArray($array);
        return $char;
    }
}